<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <form>
            <div>
                <label for="username">用户名：</label>
                <input type="text"
                       id="username"
                       v-model="loginform.username"
                />
            </div>
            <div>
                <label for="pwd">密码：</label>
                <input type="text"
                       id="pwd"
                       v-model="loginform.pwd"
                />
            </div>
            <div>
                <button @click.prevent="login">登录</button>
            </div>
        </form>
    </div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script>
<script src="https://unpkg.com/axios@0.19.0/dist/axios.min.js"></script>
<script>
     const vm=new Vue({
         el:"#app",
         data:{
             loginform:{
                 username:'',
                 pwd:''
             }
         },
         methods:{
             login(){
                 console.log(this.loginform);
                 axios.post('/login',this.loginform).then(response=>{
                     console.log(response)
                 })
             }
         }
     })
</script>
</html>